﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Data.OleDb;

public partial class updata : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Form["Submit"] != null)
        {
            OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\air\Desktop\ASP.net\App_Data\MainDB.mdb;Persist Security Info=True");
            OleDbCommand mycomm = new OleDbCommand("INSERT INTO [Species] (ScientificName,ChineseName,CommonName,FlowerColor,FlowerStyle,FlowerSize,LeafStyle,Height,PopIntro) VALUES ('" + Request.Form["ScientificName"] + "', '" + Request.Form["ChineseName"] + "', '" + Request.Form["CommonName"] + "', " + Request.Form["FlowerColor"] + ", " + Request.Form["FlowerStyle"] + ", " + Request.Form["FlowerSize"] + ", " + Request.Form["LeafStyle"] + ", " + Request.Form["Height"] + ", '" + Request.Form["PopIntro"] + "')", conn);
            conn.Open();
            mycomm.ExecuteNonQuery();
            conn.Close();
            Response.Write("添加成功！");
        }
    }
}
